const express = require('express')
const path = require('path')
const router = express.Router()

router.get('/:avatar_id', (req, res) => {
  res.setHeader('Access-Control-Allow-Origin', '*')

  const { avatar_id } = req.params

  const filePath = path.join(__dirname, 'uploads', 'avatar', avatar_id)
  // console.log('filePath: ', filePath)
  
  res.sendFile(filePath)
})

module.exports = router
